
import 'package:flutter/cupertino.dart';
import 'package:flutter_svg/flutter_svg.dart';

class MyPainter extends CustomPainter{


  DrawableRoot drawableRoot;

  MyPainter(DrawableRoot drawableRoot){
    this.drawableRoot = drawableRoot;
  }



  @override
  void paint(Canvas canvas, Size size) {
    if(drawableRoot==null){
       return;
    }

    print('begin draw----------'+size.toString());
    drawableRoot.scaleCanvasToViewBox(canvas, size);
    drawableRoot.clipCanvasToViewBox(canvas);
    drawableRoot.draw(canvas, null, drawableRoot.viewport.viewBoxRect);
    print('end draw----------');


  }

  @override
  bool shouldRepaint(CustomPainter oldDelegate) {
    return true;
  }


}